using System;
using System.Collections.Generic;
using System.Text;
using IGlobalist.Cms.Model;

namespace IGlobalist.Cms.Bll
{
   public class FAQController : BaseController
   {
       public static long InsertFAQ(IFAQ faq)
       {
           long id = _Ds.InsertObject((ICmsObject)faq);
           return id;
       }

      
       public static IList<IFAQ> GetFAQList()
       {
           return ConvertListObject2FAQList(_Ds.GetObjectListAllByClassTypeID((short)CmsObjectType.FAQ));
       }

       public static IFAQ GetFAQ(long id)
       {
           return ConvertCmsObject2FAQ(_Ds.GetObject(id));
       }

       public static IList<IFAQ> ConvertListObject2FAQList(IList<ICmsObject> list)
       {
           IList<IFAQ> listFAQs = new List<IFAQ>();
           if (list != null)
               foreach (ICmsObject f in list)
               {
                   listFAQs.Add(ConvertCmsObject2FAQ(f));
               }
           return listFAQs;
       }

       public static IFAQ ConvertCmsObject2FAQ(ICmsObject obj)
       {

           IFAQ faq = new FAQ();
           faq.FromCmsObject(obj);
           if (obj == null) return null;
           return faq;
       }
       public static void UpdateFAQ(IFAQ faq)
       {
           _Ds.UpdateObject((IFAQ)faq);
       }

       public static void DeleteAd(long id)
       {
           _Ds.DeleteObject(id);
          
       }
   }
}
